$(function () {
    var querystring = window.location.search;
    var id = (querystring.match(/id=(\w*)/))[1];
    var nodeidx = (querystring.match(/node=(\w+)/))[1];
    var INFO = window.NODE[nodeidx];
    $(".title_left").text((id == "" ? "新增" : "编辑") + "----" + INFO.title);
    function closeMe() {
        window.parent.$('#topTabs').tabs('close', (id == "" ? "新增" : "编辑"));
    }
    if (id != "") {
        var row = [{ ID: "999",
                ZZJGID: "221", XMMC: "xxx",
                XMZT: "开工", YZ: "xxx", CBS: "xxx",
                JSGM: "1", JHZTZE: "xxx", SJZTZE: "xxx",
                JHKGRQ: "xxx", JHGQ: "xxx", SJKGRQ: "xxx", SJGQ: "xxx"
            }];
        var opt = $.extend({ formValues: row, formCancel: closeMe }, INFO.formOpt);
        $("#editFrm").autoForm(opt);
    }
    else {
        $("#editFrm").autoForm($.extend({ formCancel: closeMe }, INFO.formOpt));
    }
});
